package com.palpiteiro.dao;

import java.sql.Connection;
import java.sql.DriverManager;
import java.sql.SQLException;

public class EmpresasConnectionFactory {

	private static Connection conn = null;
	
	public static Connection getConn() {
		if(conn == null)
			try {
				Class.forName("org.postgresql.Driver");
	            conn = DriverManager.getConnection("jdbc:postgresql://localhost:5432/BD_Empresas","postgres", "admin");  
			} catch (SQLException e) {
				// TODO Auto-generated catch block
				e.printStackTrace();
			} catch (ClassNotFoundException e) {
				// TODO Auto-generated catch block
				e.printStackTrace();
			}   
		return conn;
	}
	
	public static void setConn(Connection conn) {
		EmpresasConnectionFactory.conn = conn;
	}
}
